import request from '../utils/request';


// 获取全部分类
export function getCateList() {
    return request({
        url: '/category/getAllList',
        method: 'get',
    });
}


// 获取一个分类信息
export function getOneCate(id) {
    return request({
        url: `/category/getInfo?id=${id}`,
        method: 'get',
    });
}


// 添加分类
export function addCate(category) {
    return request({
        url: `/category/addCate/`,
        method: 'post',
        data: category,
        headers: { Authorization: `Bearer ${window.sessionStorage.getItem('token')}` }
    });
}

// 修改分类
export function editCate(category) {
    return request({
        url: `/category/updateCate`,
        method: 'put',
        data: category,
        headers: { Authorization: `Bearer ${window.sessionStorage.getItem('token')}` }
    });
}


// 删除分类
export function deleteCate(id) {
    return request({
        url: `/category/deleteCate/${id}`,
        method: 'delete',
        headers: { Authorization: `Bearer ${window.sessionStorage.getItem('token')}` }
    });
}